# -*- coding:utf-8 -*-
"""
@author:shengwei
@file:Alipay.py
@time:2018/2/12 001215:46
"""


# class Alipay(object):
#     def __init__(self, name):
#         self.name = name
#
#     def __str__(self):
#         return 'str is set %s' % self.name
#
#     __repr__ = __str__
#
#
# A = Alipay('sw')
class Fib(object):
    def __init__(self):
        self.a, self.b = 1, 2  # 初始化两个计数器a，b

    def __iter__(self):
        return self  # 实例本身就是迭代对象，故返回自己

    def __next__(self):
        self.a, self.b = self.b, self.a + self.b
        if self.a > 10000:
            raise StopIteration()
        return self.a
